<?
// handle errors
handle_error($errors);
?>
<!DOCTYPE HTML><html>
<head>
<? echo $h->meta($title, $kwd, $dpn); ?>
<? require_once("lib.php"); ?>
<script src="<?=$ecom?>/js/jquery.validate.js" type="text/javascript"></script>
<script src="<?=$ecom?>/js/jquery.metadata.js" type="text/javascript"></script>
</head>
<body id="">
<? include_once("header.php"); ?>
<div id="wrap">
	<div class="breadcrumb">
		<a href="./"><?=WEB_INDEX_PAGE?></a> &gt; <span><?=WEB_LOGIN?></span>
	</div><!--breadcrumb end-->
	<div id="login" class="">
		<div class="login">
			<div class="left"><img src="<?=$ecom?>/images/login_show.jpg" /></div>
			<div class="login_box right"><div class="login_boxer">
				<form method="post" class="need_check">
					<? 
					// 签名以过滤非法提交表单
					$key=md5('ecomgear'.date('Ymd'));
					echo $h->hidden('key',$key);
					echo $h->hidden('action','login'); ?>
					<h2><?=WEB_LOGIN?></h2>
					<table width="100%">
						<tr><td width="80" class="tright"><span class="error">*</span> <?=WEB_EMAIL?>: </td><td><input type="text" value="<?=$tem_email?>" class="g {validate:{required:true, email:true, messages:{required:'<?=WEB_EMAIL_REQUIRED?>', email:'<?=WEB_INVALID_EMAIL?>'}}}" name="email" /></td></tr>
						<tr><td class="tright"><span class="error">*</span> <?=WEB_PASSWORD?>: </td><td><input type="password" class="g {validate:{required:true, minlength:<?=$config['PASSWORD_MIN_LENGTH']?>, messages:{required:'<?=WEB_PASSWORD_REQUIRED?>', minlength:'<? printf(WEB_PASSWORD_MIN_LENGTH,$config['PASSWORD_MIN_LENGTH'])?>'}}}" name="password" /></td></tr>
						<tr><td class="tright"><span class="error">*</span> <?=WEB_CAPTCHA?>: </td><td><input type="text" class="gs" name="code" /> &nbsp; <img src="api_ver_code.php" width="72" /><span class="error"></span></td></tr>
						<tr><td>&nbsp;</td><td><input type="submit" class="hand button_blue" value="<?=WEB_LOGIN?>" /> | <a class="blue" href="forgot_password.php"><?=WEB_RESET_PASSWORD?></a> | <a class="blue" href="register.html"><?=WEB_REGISTER?></a>
						</td></tr>
					</table>
				</form>
				<div class="clear"></div>
			</div></div>
		</div>
	</div><!--#register-->
		<div class="clear"></div>
	<div class="px20"></div>
	<div class="clear"></div>
</div>
<? include("footer.php"); ?>
<script type="text/javascript">
  $(document).ready(function(){
	jQuery.validator.addMethod("ver_code", function(value, element) {
	var flag = 0;
	if(value.length < 4) return true;
	$.ajax({
		type:"GET", url:'ajax_ver_code.php', async:false,
		data:{'code':value},
		success: function(msg){ if(msg == 'yes'){ flag = 1; }}
	});
	if(flag == 0) return false; else return true;
	}, "<?=WEB_INPUT_ERROR?>");
  	$(".need_check").validate({meta: "validate",
  		rules:{
  			code:{required:true,ver_code:true,minlength:4}
  		},
  		messages:{
  			code:{required:'<?=WEB_CAPTCHA_REQUIRED?>'
  			}
  		},
		onkeyup: false,
		errorPlacement: function( label, element ) {
			element.parent().append("<br>").append(label);
		}
  });
});
</script>
</body>
</html>